package com.doraro.platform.module.device.model.param.cond;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.doraro.platform.module.device.model.entity.RepairAdvice;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Objects;

/**
 * 维修建议分页条件
 */
@Data
public class AdviceCond implements BaseCond<RepairAdvice> {
    private Integer id;
    @ApiModelProperty(value = "订单id")
    private String orderId;
    @ApiModelProperty(value = "工程师id")
    private String engineerId;
    @ApiModelProperty(value = "维修方案")
    private String repairInfo;
    @ApiModelProperty(value = "维修花费")
    private BigDecimal cost;
    @ApiModelProperty(value = "0-建议中 1-采纳 2-拒绝")
    private Integer sStatus;

    @Override
    public LambdaQueryWrapper<RepairAdvice> condition() {
        return new LambdaQueryWrapper<RepairAdvice>()
                .like(Objects.nonNull(id), RepairAdvice::getId, id)
                .like(Objects.nonNull(orderId), RepairAdvice::getOrderId, orderId)
                .like(Objects.nonNull(engineerId), RepairAdvice::getEngineerId, engineerId)
                .like(Objects.nonNull(repairInfo), RepairAdvice::getRepairInfo, repairInfo)
                .eq(Objects.nonNull(cost), RepairAdvice::getCost, cost)
                .eq(Objects.nonNull(sStatus), RepairAdvice::getSStatus, sStatus)
                ;
    }
}
